<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>车辆二维码</title>
    <style>
    	body{
    		overflow-x:hidden;
            margin: 0;
    	}
    	.odiv2{
		   display:table;
		   background:#fff;
		   width:100%;
		   padding:5px;
		   border-top:1px solid #E1E1E1; 
		   border-bottom:1px solid #E1E1E1; 
	    }
    	.odiv{
		   display:table;
		   background:#fff;
		   width:100%;
		   padding:5px;
		   border-bottom:1px solid #E1E1E1; 
	   }
	   .idiv{
		   float: left;
		   font-size:14px;
		   height:30px;
		   line-height:30px;
	   }
	   .div_text{
		   float: right;
		   height:30px;
		   line-height:30px;
		   width:60%;
		   color: #8d8d8d;
		   font-size:14px;
		   text-align: left;
		   overflow:hidden;
		   white-space: nowrap; 
		   text-overflow: ellipsis;
		   border:none;
	   }
    </style>
</head>
<body style="height:88%;">
<header id="statusBar">
		<div style="width:100%;display:table;background: #fff;position:fixed;border-bottom:1px solid #EAEAEA;z-index: 9999;height: 50px;" >
			<div style="float:left;width: 20%;height: 50px;line-height: 50px;" tapmode="presshover" onclick="api.closeWin();">
			  <div style="float:left;width: 30%;height: 50px;">
			   <img style="width: 24px;margin-top: 13px;" src="../../image/blc_back.png" />
			   </div>
			   <div style="float:left;width: 50%;">
			   返回
			   </div>
			</div>
			<div style="float:left;width: 60%;height: 50px;line-height: 50px;text-align: center;font-weight:bold;">
			 二维码信息
			</div>
		</div>
	</header>
<div style="height: 50px;"></div>
	<!--条形码-->	  
    <!--<div id="barcode" style="clear:both;border: none;border-radius:0px;background-color: #FFF" ></div>-->
	<div style="background: #ffffff;height: 400px;width: 90%;margin: 0 auto;border-radius: 10px;text-align: center;">
      <!-- 二维码 -->
      <!--<div style="margin: 0 auto;font-size: 20px;padding: 30px;" id="titel">
      </div>-->
      <div id="cmqr" style="font-size: 20px;margin: 0 auto;text-align: center;padding-top: 10px;">
      </div>
      <div id="detailInfo" style="margin: 10px auto;text-align: center;padding-top: 10px;width: 80%;display: none">
      	<p class="odiv2"><label class="idiv">姓名：</label><input class="div_text" readonly id="DRIVER_NAME"/></p>
      	<p class="odiv"><label class="idiv">身份证：</label><input class="div_text" readonly id="DRIVER_CARD"/></p>
      	<p id="car_no" class="odiv"><label class="idiv">车牌号：</label><input class="div_text" readonly id="PLATE_NUM"/></p>
      	<p class="odiv"><label class="idiv">联系方式：</label><input class="div_text" readonly id="DRIVER_TELEPHONE"/></p>
      	
      </div>
 	</div> 
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/constants.js"></script>
<script src="../../resource/jquery214.js"></script>
<script src="../../script/qrcode.js"></script>
<script src="../../resource/jquerybarcode.js"></script>
<script type="text/javascript" src="../../script/aes.js"></script>
<script type="text/javascript" charset="UTF-8" src="../../script/naes.js"></script>
<script type="text/javascript" src="../../script/modeecb.js"></script>
<script src="../../script/tmd5.js"></script>
<script type="text/javascript">
	apiready = function(){
		$api.fixStatusBar($api.dom('header'));
		if(api.systemType=="ios"){
			document.getElementById("statusBar").style.background="#298cb4";
		}
		var id = api.pageParam.cl_defid;
		var uiId;
		var UILoading = api.require('UILoading');
		UILoading.flower({
            center: {
	            x: api.winWidth/2.0,
	            y: api.winHeight/2.0
            },
            size: 30,
            fixed: true,
            mask: "rgba(0,0,0,0.5)"
        },function(ret,err){
        	uiId = ret.id;
        });
        var qrString = "QRTYPE=SCHX_CLGL";
		var callback = function(ret,err){
            if(ret){
            	if(ret.success){
            		var main = ret.main;
            		var detail = ret.detail;
            		$("#DRIVER_NAME").val(main.DRIVER_NAME);
            		$("#DRIVER_CARD").val(main.DRIVER_CARD);
            		if(main.PLATE_NUM == undefined || main.PLATE_NUM == "undefined"){
            		   $("#car_no").hide();
            		}else{
            		   $("#PLATE_NUM").val(main.PLATE_NUM);
            		}
            		$("#DRIVER_TELEPHONE").val(main.DRIVER_TELEPHONE);
            		qrString += "&ID="+id;
//          		qrString += "&DRIVER_NAME="+ main.DRIVER_NAME;
//          		qrString += "&DRIVER_CARD="+ main.DRIVER_CARD;
//          		if(main.PLATE_NUM == undefined || main.PLATE_NUM == "undefined"){
//          		   qrString += "&PLATE_NUM=";
//          		}else{
//          		   qrString += "&PLATE_NUM="+ main.PLATE_NUM;
//          		}
//          		qrString += "&DRIVER_TELEPHONE="+ main.DRIVER_TELEPHONE;
//          		var PASSENGER_NAMES="";
//          		var PASSENGER_TELEPHONES="";
//          		var PASSENGER_IDCARDS="";
//          		if(detail.length>0){
//          			var count=0;
//          			for(var i=0;i<detail.length;i++){
//          				var PASSENGER_TELEPHONE = detail[i].PASSENGER_TELEPHONE;
//          				if(PASSENGER_TELEPHONE==null||PASSENGER_TELEPHONE==undefined){
//          					PASSENGER_TELEPHONE="";
//          				}
//          				if(count==0){
//          				    PASSENGER_IDCARDS+=detail[i].PASSENGER_IDCARD;
//          					PASSENGER_NAMES+=detail[i].PASSENGER_NAME;
//          					PASSENGER_TELEPHONES+=PASSENGER_TELEPHONE;
//          					count++;
//          				}else{
//          				    PASSENGER_IDCARDS+=","+detail[i].PASSENGER_IDCARD;
//          					PASSENGER_NAMES+=","+detail[i].PASSENGER_NAME;
//          					PASSENGER_TELEPHONES+=","+PASSENGER_TELEPHONE;
//          				}
//          			}
//          		}
//          		qrString += "&PASSENGER_NAMES="+ PASSENGER_NAMES;
//          		qrString += "&PASSENGER_TELEPHONES="+ PASSENGER_TELEPHONES;
//          		qrString += "&PASSENGER_IDCARDS="+ PASSENGER_IDCARDS;
//          		qrString += "&ENTER_DATE="+ main.ENTER_DATE;
//          		qrString += "&LEAVE_DATE="+ main.LEAVE_DATE;
//          		qrString += "&ENTER_REASON="+ main.ENTER_REASON;
            		
            		$('#cmqr').qrcode({width:260,height:260,correctLevel:0,text:utf16to8(qrString)});
            		$("#detailInfo").show();
            		//条形码绘制
        			//barcode(qrString);
        			UILoading.closeFlower({
		                id: uiId
		            });
            	}else{
            		api.alert({msg: "初始化失败！原因："+ret.msg});
            	}
            }else{
            	UILoading.closeFlower({
	                id: uiId
	            });
            	api.alert({msg:"初始化失败，原因："+err.msg});
        	}
		};
		var content = {"id":id};
		apiAjax(JSON.stringify(content),url.getDriverInfo,callback);
	};
	
	function toindex(){
		api.closeWin();
	}
  
    function utf16to8(str) { var out, i, len, c; out = ""; len = str.length; for(i = 0; i < len; i++) { c = str.charCodeAt(i); if ((c >= 0x0001) && (c <= 0x007F)) { out += str.charAt(i); } else if (c > 0x07FF) { out += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F)); out += String.fromCharCode(0x80 | ((c >> 6) & 0x3F)); out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F)); } else { out += String.fromCharCode(0xC0 | ((c >> 6) & 0x1F)); out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F)); } } return out; }	

//	function barcode(str){
//	    $("#barcode").html('');
//	    //绘制条形码 
//	    $("#barcode").barcode(str, "code128",{
//	      width:0,
//	      output:'bmp',       //渲染方式 css/bmp/svg/canvas
//	      bgColor: '#ffffff', //条码背景颜色
//	      color: '#000000',   //条码颜色
//	      barWidth: 2,        //单条条码宽度
//	      barHeight: 80,     //单体条码高度
//	      // moduleSize: 1,   //条码大小
//	      // posX: 10,        //条码坐标X
//	      // posY: 5,         //条码坐标Y
//	      addQuietZone: false  //是否添加空白区（内边距）
//	    });
//	    //  $("#barcode").css('width', '60rem');
//	    $("#barcode").width(document.documentElement.clientWidth*0.9);
//	}
</script>
</html>